<template>
  <div class="aside">
    <el-menu
      class="el-menu-vertical-demo"
      background-color="#071b40"
      text-color="#fff"
      :unique-opened="true"
      :router="true"
      :default-active="defaultActive"
      active-text-color="#369dff"
    >
      <el-menu-item index="user">
        <template slot="title">
          <i class="el-icon-user"></i>
          <span>用户管理</span>
        </template>
      </el-menu-item>
      <el-menu-item index="cuisine">
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span>菜系管理</span>
        </template>
      </el-menu-item>
      <el-menu-item index="taste">
        <template slot="title">
          <i class="el-icon-knife-fork"></i>
          <span>口味管理</span>
        </template>
      </el-menu-item>
      <el-menu-item index="dishes">
        <template slot="title">
          <i class="el-icon-food"></i>
          <span>菜品管理</span>
        </template>
      </el-menu-item>
      <el-menu-item index="tables">
        <template slot="title">
          <i class="el-icon-dish-1"></i>
          <span>餐桌管理</span>
        </template>
      </el-menu-item>
      <el-menu-item index="orders">
        <template slot="title">
          <i class="el-icon-shopping-cart-2"></i>
          <span>订单管理</span>
        </template>
      </el-menu-item>
      <el-menu-item index="reports">
        <template slot="title">
          <i class="el-icon-s-data"></i>
          <span>报表统计</span>
        </template>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  data() {
    return {
      defaultActive: "reports",
    };
  },
  watch: {
    $route(newVal) {
      console.log(newVal);
      this.defaultActive = newVal.path.slice(1);
    },
  },
};
</script>

<style>
.aside {
  width: 180px;
}
.el-menu {
  border: 0 !important;
}
</style>
